# Maintainer: AndyRTR <andyrtr@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - patch for AArch64

pkgname=imake
pkgver=1.0.10
pkgrel=2
pkgdesc="X.Org imake program and related utilities"
arch=('x86_64')
url="https://xorg.freedesktop.org/"
license=('MIT-open-group' 'HPND')
depends=('glibc')
makedepends=('pkgconfig' 'xorgproto' 'perl' 'xorg-util-macros' 'xorg-font-util')
optdepends=('perl: for mkhtmlindex')
source=(https://xorg.freedesktop.org/archive/individual/util/imake-${pkgver}.tar.xz{,.sig}
        https://xorg.freedesktop.org/releases/individual/util/gccmakedep-1.0.4.tar.xz{,.sig}
        https://xorg.freedesktop.org/releases/individual/util/lndir-1.0.5.tar.xz{,.sig}
        https://xorg.freedesktop.org/releases/individual/util/makedepend-1.0.9.tar.xz{,.sig}
        https://xorg.freedesktop.org/releases/individual/util/xorg-cf-files-1.0.8.tar.xz{,.sig}
        linuxconfig.patch
        aarch64.patch
        LICENSE)
sha512sums=('ea96db27a6da13ea2d64652936e508b5e3d5d712347a2eb248376dc1f262c18720d9934b8ae69b4c0fc65b135c847be42da084fe924e4825ce1d359f4ef7e60f'
            'SKIP'
            '7665923de51256720e7ae73c09f3c8c908c5cda2e204afac60e3c1ef45c7211cee303629ab9e53171df2a37765944a8a85a654bb1b2e90df9f497dff7d9d29a8'
            'SKIP'
            'f6c1498ed0d867d4aa98ef098a9ab57027ac4e852f688b2c1695a3c9ca571b927bc401925e3bd7951fbf0db54798a55f838c4a4ad113dafd95d811ba61551061'
            'SKIP'
            '68d289656314dc9f12c792d0e394cfbc95404a0d01155dbcb38313d451b506da48a3d44183f568a2cbb2b1d1da9e26703a0d92f2bb658f72fc968eeb03bf2fe8'
            'SKIP'
            'cc633af889cd82346c3098df9185245c21aa9db7484343f8be9719f6e0b1fc0a9b09afb13b9b864668aa51944f2da797bbe896c807f629e89fc91506e6e63fb9'
            'SKIP'
            'e2a42d60ca39a14ac7944af04eb76dfe9b194cfad8d853730a29aa43f93f2b4acce8d6e8d7a36901b201822c8c5879093fadb6e63f448f5915878909e3797735'
            '6bfb9bf7802436ba12b071b848dcd0d7bb5cb926a155a0e5538aed638b4f97ae2abb1e9d551fce7bd3b9df8c3127185d8ac538c36c3d9a87517d5094dc9e8554'
            '1ded8ef51405e3b0144a633b612270cb1c71e7365852653284a587972f68a390252ca73350517bac621006cab6410745974a960d9fd0d3f76dcb9face69aada9')
validpgpkeys=('4A193C06D35E7C670FA4EF0BA2FB9E081F2D130E') #Alan Coopersmith <alan.coopersmith@oracle.com>

prepare() {
  cd xorg-cf-files-1.0.8
  patch -p1 -i ../linuxconfig.patch
  patch -p2 -i ../aarch64.patch
}

build() {
  for i in *; do
    if [ -d "${i}" ]; then
      pushd "${i}"
      autoreconf -fi
      ./configure --prefix=/usr --mandir=/usr/share/man
      make
      popd
    fi
  done
}

package() {
  for i in *; do
    if [ -d "${i}" ]; then
      pushd "${i}"
      make DESTDIR="${pkgdir}" install
      popd
    fi
  done
  install -D -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
